home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / e / EasyPLUGINs.lha / EasyPLUGINs / examples / dclistview_demo.e next >
Text File  |  1997-09-24  |  2KB  |  51 lines

  1. OPT PREPROCESS, OSVERSION=37
  2.  
  3. MODULE 'tools/exceptions', 'tools/EasyGUI', 'exec/nodes', 'exec/lists',
  4.        'easyplugins/dclistview', 'tools/constructors'
  5.  
  6. DEF result=-1
  7.  
  8. PROC main() HANDLE
  9.   DEF dclist:PTR TO dclistview_plugin
  10.   DEF list, a, nodes
  11.   list:=newlist()
  12.   nodes:=['zero','one','two','three','four','five','six','seven',
  13.           'eight','nine','ten','eleven','twelve','thirteen','fourteen']
  14.   ForAll({a}, nodes, `AddTail(list, newnode(NIL, a)))
  15.   NEW dclist.dclistview('L_abel', 15,7, list,result,"a",FALSE)
  16.   easyguiA('Double Click test',
  17.           [EQROWS,
  18.             [DCLIST, {listaction},dclist,TRUE],  ->note use of ID constant (=PLUGIN)
  19.             [EQCOLS,
  20.               [SBUTTON, {okaction}, '_OK', dclist, "o"],
  21.               [SBUTTON, {disabler}, '_Disable', dclist, "d"],
  22.               [SBUTTON, {cancelaction}, '_Cancel', NIL, "c"]
  23.             ]
  24.           ])
  25. EXCEPT DO
  26.   END dclist
  27.   IF exception<>"QUIT" THEN report_exception()
  28. ENDPROC
  29.  
  30. PROC listaction(info, dclist:PTR TO dclistview_plugin)
  31.   IF dclist.clicked THEN okaction(dclist, NIL)
  32.   PrintF('Current Selection: \d\n',dclist.current)
  33. ENDPROC
  34.  
  35. PROC okaction(dclist:PTR TO dclistview_plugin, info)
  36.   IF (result:=dclist.current)= -1
  37.     PrintF('No selection made\n')
  38.     cancelaction(info)
  39.   ENDIF
  40.   PrintF('Final Selection: \d\n',result)
  41.   quitgui(result)
  42. ENDPROC
  43.  
  44. PROC disabler(dclist:PTR TO dclistview_plugin, info) IS dclist.setdisabled(dclist.disabled=FALSE)
  45.  
  46. PROC cancelaction(info)
  47.   PrintF('Operation cancelled.\n')
  48.   quitgui()
  49. ENDPROC
  50.  
  51.